﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Security.Permissions;

[assembly: CLSCompliant(true)]
namespace TwoPageView
{
    static class Program
    {
        private static System.Threading.Mutex mutex;

        [STAThread]
        static void Main(string[] args)
        {
            System.Resources.ResourceManager rm = TwoPageView.Properties.Resources.ResourceManager;

            bool createdNew;
            mutex = new System.Threading.Mutex(true, "TwoPageView", out createdNew);
            if (false == createdNew) {
                Console.WriteLine("D: Main() multiple instance of application");
                DialogResult dr = MessageBox.Show(rm.GetString("MultipleInstanceWarningText"), rm.GetString("MultipleInstanceWarningText"),
                    MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (dr != DialogResult.Yes) {
                    return;
                }
            }
            //System.Threading.Thread.CurrentThread.Priority = System.Threading.ThreadPriority.Highest;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DirectoryOrZipDirInfo d = DirectoryOrZipDirInfo.Factory(args);
           // try {
                Application.Run(new Form1(d));
            //} catch (System.Exception ex) {
            //   System.Windows.Forms.MessageBox.Show(ex.ToString());
           // } finally {
                DirectoryOrZipDirInfo.RemoveTmpDirs();
            //}
            Console.WriteLine("D: Main() end");
        }
    }
}